/*
 * @Author: Wxx
 * @Date: 2022-02-27 15:53:05
 * @LastEditors: Wxx
 * @LastEditTime: 2022-02-27 16:12:31
 * @Description:
 */
import React, { Component } from "react";
import { Map } from "immutable";

export default class map extends Component {
  state = {
    info: Map({
      name: "xx",
      age: 19,
      filter: Map({
        name: "child",
      }),
    }),
  };
  render() {
    const { info } = this.state;
    return (
      <div>
        <button
          onClick={() => {
            this.setState({ info: this.state.info.set("name", "xiaoming") });
          }}
        >
          click
        </button>
        {info.get("name")}-{info.get("age")}
        <Child age={info.get("filter")} />
      </div>
    );
  }
}
class Child extends Component {
  shouldComponentUpdate(nextProps, nextState) {
    if (this.props.filter === nextProps.filter) {
      return false;
    }
    return true;
  }
  render() {
    console.log("render");
    return <div>child</div>;
  }
}
